package com.gxl.design.compositepattern;

import java.util.ArrayList;
import java.util.List;

public class Area {

    private String name;

    private Integer number;


    private List<Area> contries = new ArrayList<>();

    public List<Area> getContries() {
        return contries;
    }

    public Area(String name, Integer number) {
        this.name = name;
        this.number = number;
    }

    public Area add(Area contry){
        contries.add(contry);
        return this;
    }

    @Override
    public String toString() {
        return "Area{" +
                "name='" + name + '\'' +
                ", number=" + number +
                '}';
    }
}
